import { IPSDEField } from '../defield/ipsdefield';
import { IPSDERCustom } from './ipsdercustom';
import { PSDERBaseImpl } from './psderbase-impl';
import { IPSDEDataSet } from '../ds/ipsdedata-set';
import { IPSLanguageRes } from '../../res/ipslanguage-res';

export class PSDERCustomImpl extends PSDERBaseImpl implements IPSDERCustom {
  get customExportOrder(): number {
    return this.M.customExportOrder != null ? this.M.customExportOrder : -1;
  }

  get customExportOrder2(): number {
    return this.M.customExportOrder2 != null ? this.M.customExportOrder2 : -1;
  }

  get dERSubType(): string {
    return this.M.dERSubType;
  }

  get masterRS(): 1 | 2 | 4 | 8 | 16 {
    return this.M.masterRS;
  }

  protected nestedpsdedataset: IPSDEDataSet | null = null;

  getNestedPSDEDataSet(): IPSDEDataSet | null {
    if (this.nestedpsdedataset != null) return this.nestedpsdedataset;
    const value = this.M.getNestedPSDEDataSet;
    if (value == null) {
      return null;
    }
    this.nestedpsdedataset = this.getMinorPSDataEntityMust().findPSDEDataSet(value);
    return this.nestedpsdedataset;
  }

  get nestedPSDEDataSet(): IPSDEDataSet | null {
    return this.getNestedPSDEDataSet();
  }

  getNestedPSDEDataSetMust(): IPSDEDataSet {
    const value = this.getNestedPSDEDataSet();
    if (value == null) {
      throw new Error('未指定嵌套成员数据集对象');
    }
    return value;
  }

  protected one2xdatapsdefield: IPSDEField | null = null;

  getOne2XDataPSDEField(): IPSDEField | null {
    if (this.one2xdatapsdefield != null) return this.one2xdatapsdefield;
    const value = this.M.getOne2XDataPSDEField;
    if (value == null) {
      return null;
    }
    this.one2xdatapsdefield = this.getPSModel4('dataentity.defield.IPSDEField', value, 'getOne2XDataPSDEField') as IPSDEField;
    return this.one2xdatapsdefield;
  }

  get one2XDataPSDEField(): IPSDEField | null {
    return this.getOne2XDataPSDEField();
  }

  getOne2XDataPSDEFieldMust(): IPSDEField {
    const value = this.getOne2XDataPSDEField();
    if (value == null) {
      throw new Error('未指定一对多关系数据属性');
    }
    return value;
  }

  get pickupDEFName(): string {
    return this.M.pickupDEFName;
  }

  protected pickuppsdefield: IPSDEField | null = null;

  getPickupPSDEField(): IPSDEField | null {
    if (this.pickuppsdefield != null) return this.pickuppsdefield;
    const value = this.M.getPickupPSDEField;
    if (value == null) {
      return null;
    }
    this.pickuppsdefield = this.getPSModel4('dataentity.defield.IPSDEField', value, 'getPickupPSDEField') as IPSDEField;
    return this.pickuppsdefield;
  }

  get pickupPSDEField(): IPSDEField | null {
    return this.getPickupPSDEField();
  }

  getPickupPSDEFieldMust(): IPSDEField {
    const value = this.getPickupPSDEField();
    if (value == null) {
      throw new Error('未指定关系属性');
    }
    return value;
  }

  protected pickuptextpsdefield: IPSDEField | null = null;

  getPickupTextPSDEField(): IPSDEField | null {
    if (this.pickuptextpsdefield != null) return this.pickuptextpsdefield;
    const value = this.M.getPickupTextPSDEField;
    if (value == null) {
      return null;
    }
    this.pickuptextpsdefield = this.getPSModel4('dataentity.defield.IPSDEField', value, 'getPickupTextPSDEField') as IPSDEField;
    return this.pickuptextpsdefield;
  }

  get pickupTextPSDEField(): IPSDEField | null {
    return this.getPickupTextPSDEField();
  }

  getPickupTextPSDEFieldMust(): IPSDEField {
    const value = this.getPickupTextPSDEField();
    if (value == null) {
      throw new Error('未指定关系主信息属性');
    }
    return value;
  }

  get rRMLanResTag(): string {
    return this.M.rRMLanResTag;
  }

  protected rrmpslanguageres: IPSLanguageRes | null = null;

  getRRMPSLanguageRes(): IPSLanguageRes | null {
    if (this.rrmpslanguageres != null) return this.rrmpslanguageres;
    const value = this.M.getRRMPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.rrmpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getRRMPSLanguageRes') as IPSLanguageRes;
    return this.rrmpslanguageres;
  }

  get rRMPSLanguageRes(): IPSLanguageRes | null {
    return this.getRRMPSLanguageRes();
  }

  getRRMPSLanguageResMust(): IPSLanguageRes {
    const value = this.getRRMPSLanguageRes();
    if (value == null) {
      throw new Error('未指定删除拒绝消息语言资源');
    }
    return value;
  }

  get removeActionType(): 0 | 1 | 2 | 3 {
    return this.M.removeActionType;
  }

  get removeOrder(): number {
    return this.M.removeOrder;
  }

  get removeRejectMsg(): string {
    return this.M.removeRejectMsg;
  }

  get typeValue(): string {
    return this.M.typeValue;
  }

  get cls(): string {
    return 'PSDERCustomImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.der.IPSDERCustom') return true;
    return super.instanceof(cls);
  }
}
